﻿#region

using System.Web.Mvc;
using CuongHanh.DAL;
using CuongHanh.Service;

#endregion

namespace CuongHanh.Controllers.FO
{
    public class WoodController : BaseController
    {
        private const int CODE = AppUtil.WOOD_CODE;

        private readonly UnitOfWork _unitOfWork = new UnitOfWork();

        public ActionResult Index()
        {

            //VirtualDataService.CreateProductByBranch(1);
            //VirtualDataService.CreateProductByBranch(2);
            //VirtualDataService.CreateProductByBranch(3);
            return View(GetProductsByFilter(c => c.BranchId == CODE && c.IsShowIndex && !c.Inactive));
        }

        public ActionResult Category(int id)
        {
            return View(GetProductsByFilter(c => c.BranchId == CODE && c.CategoryId == id && !c.Inactive));
        }

        public ActionResult SubCategory(int id)
        {
            return View(GetProductsByFilter(c => c.BranchId == CODE && c.SubCategoryId == id && !c.Inactive));
        }

        public ActionResult Product(int id)
        {
            return View(GetProductDetail(_unitOfWork,
                    id,
                    CODE));
        }
    }
}
